var _page = $('.page');

var ageRand = $("input[name='ageRand']").val();
if(ageRand){
    ageRand = ageRand.split('-');
}else{
    ageRand = [21,45];
}

//开启范围选择
layui.slider.render({
    elem: '.age-slide'
    ,value: ageRand //初始值
    ,min: 18
    ,max: 60
    ,range: true //范围选择
    ,theme: 'var(--color)' //主题色
    ,change: function(vals){
        $("input[name='ageRand']").val(vals[0] + '-'+ vals[1]);
        $('.age-slide-tips').html('年龄:'+ vals[0] + ' - '+ vals[1]+'岁');
    }
});

var heightRand = $("input[name='heightRand']").val();
if(heightRand){
    heightRand = heightRand.split('-');
}else{
    heightRand = [160,190];
}

layui.slider.render({
    elem: '.height-slide'
    ,value: heightRand //初始值
    ,min: 150
    ,max: 200
    ,range: true //范围选择
    ,theme: 'var(--color)' //主题色
    ,change: function(vals){
        $("input[name='heightRand']").val(vals[0] + '-'+ vals[1]);
        $('.height-slide-tips').html('身高:'+ vals[0] + ' - '+ vals[1]+'CM');
    }
});





$('.vipsearch.novip').on('click', '.layui-form-item', function(event) {
    event.preventDefault();
    event.stopPropagation();
    bottlecms.log(".layui-form-item");
    popup_tips_vip();
});




// 切换展示方式
$('.js-spread').click(function(event) {
    if($(this).attr('mode') == "list"){
        $(this).attr('mode',"waterfall");
        $('.js-singles').attr('mode',"waterfall");
    }else{
        $(this).attr('mode',"list");
        $('.js-singles').attr('mode',"list");
    }
});








// 心动
$(_page).on('click', '.js-like', function() {
    var _this = this;
    var id = $(this).attr('data-id');
    var act = $(this).hasClass('on') ? 2 : 1;
    like_fun(id, act, function() {
        $(_this).toggleClass('on');
    })
})
// 聊天
$(_page).on('click', '.js-chat', function() {
    var id = $(this).attr('data-id');
    bottlecms.goto(BOTTLECMS_HOME_PATH + 'chat/' + id);
})
// 送礼物
$(_page).on('click', '.js-gift', function() {
    var id = $(this).attr('data-id');
    gift_fun(id)
})
// 打招呼
$(_page).on('click', '.js-greet', function() {
    var id = $(this).attr('data-id');
    greet_fun(id)
})
